package com.sharelords.icp.web.controller;

import com.sharelords.icp.web.result.ViewResult;
import com.sharelords.icp.web.service.IcpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 在线编程api
 *
 * @author 夜舞旋
 */
@RestController
@RequestMapping("/execute")
public class IcpController {

    @Autowired
    private IcpService icpService;

    /**
     * 只运行class的主函数main
     *
     * @return
     */
    @PostMapping("main")
    public ViewResult<String> mainExecute(@RequestParam("fileSrc") String fileSrc) {
        return icpService.mainExecute(fileSrc);
    }

}
